<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
        <%@include file="/sunzbase.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<div><a class="btn btn-primary radius" onclick="file_up()" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 上传文件</a></div>
<br />
<a href="note/fileDown?id=4&folderId=139" id="upload_down">下载</a>
<div id="fileDiv" style="display:none">
	<form id="fileForm" action="note/fileUpload" method="post" enctype="multipart/form-data">
    <div id="fade" class="black_overlay" style="visibility: visible;">
    	
	    <div id="light" class="white_content" style="width: 330px;padding: 20px 20px;">
		     <div style="padding: 0px 20px;">
		     	 <div style="float: left;padding-left: 40%;">上传文件</div><div style="float: right;font-size:15px;"><a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">x</a></div>
		     </div>	
		     <br/>
		     <input type="file" id="fileUpload" value="" multiple name="fileUpload" onchange="getFileValue()" style="display:none" />
			 <div style="margin: 20px 10px;"> <ul id="fileLable"></ul> </div>
			 <div style="float: right;"><button type="button" id="startUp" class="btn btn-primary radius">开始上传</button> &nbsp;&nbsp;<button type="button" class="btn radius" onclick="document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">取消</button></div>	     
	    </div> 
	 </div>
    </form>
</div>
<script type="text/javascript">

/* $("#upload_down").on("click",function(){
	window.open("D:\天遥航空文件管理\admin\222\641(2).jpg");
}) */

$(document).ready(function(){
	 $("#startUp").click(function(){
		 debugger;
		 $("#fileForm").ajaxSubmit(function(result){
 			if(result.success){
 				$("#fileDiv").css("display","none");
 				$('#light').css("display",'none');
 				$('#fade').css("display","none");
 				layer.msg(result.msg,{icon:6});
 			}
 		});
	 })
});
 function file_up(){
	 $("#fileUpload").click();
 }
 function getFileValue(){
	 debugger;
	 $("#fileLable").empty();
	    var fp = $("#fileUpload");
	    var lg = fp[0].files.length; // get length
	    var items = fp[0].files;
	    var fragment = "";
	     
	    if (lg > 0) {
	        for (var i = 0; i < lg; i++) {
	            var fileName = items[i].name; // get file name
	            var fileSize = items[i].size; // get file size 
	            var fileType = items[i].type; // get file type
	 
	            // append li to UL tag to display File info
	            fragment += "<li><i class='Hui-iconfont'>&#xe600;</i>&nbsp;&nbsp" + fileName + " (<b>" + fileSize + "</b> bytes) </li>";
	        }
	 
	        $("#fileLable").append(fragment);
	    }
		// $("#fileDiv").style.display='block';
		$("#fileDiv").css("display","block");
		$("#light").css("display","block");
		$("#fade").css("display","block");
 }

</script>
</body>
</html>